{% extends "stocksys/base/base_page.html" %}
{% load staticfiles %}
{% block content %}
    <script src="{% static 'stocksys/js/echarts.min.js' %}" type="text/javascript" charset="utf-8"></script>
    <script src="{% static 'stocksys/js/k-line.js' %}" type="text/javascript" charset="utf-8"></script>
    {% csrf_token %}
    <div class="content">
        <div class="container-fluid">
            <div class="row">
                <div class="col-md-6">
                    <div id="big_stock" class="card" style="min-height: 350px">
                        <div class="header card-header-icon">
                            <h4 class="title" id="stock_name"><i
                                    class="ti-pulse"></i> {{ stock.exchange_address.stock_address_name }}-{{ stock.name }}
                            </h4>
                        </div>
                        <div class="content " id="k-content" style="height:300px ;padding: 10px"></div>
                        <script type="text/javascript">
                            var year = new Date().getFullYear();
                            var url = "/stocksys/stock_info/{{ stock.code }}/" + "{{ stock.exchange_address.id }}/" + year;
                            console.log(1);
                            $.ajax({
                                url: url,
                                headers: {'X-CSRFToken': $.cookie('csrftoken')},
                                dataType: "json",
                                type: "POST",
                                success: function (data) {
                                    kdata = data["data"];
                                    var kChart = echarts.init(document.getElementById('k-content'));

                                    kChart.setOption(initKOption(kdata));
                                    $("#k-content canvas").css({"width": "100%", "height": "100%"});
                                    $("#k-content div").css({"width": "100%", "height": "100%"});
                                },
                                error: function (xhr, status, error) {

                                }
                            });
                        </script>
                    </div>
                </div>
                <div class="col-md-6 card">
                    <img style="padding: 5%"
                         src="http://image.sinajs.cn/newchart/min/n/{{ stock.exchange_address.stock_sina_name }}{{ stock.code }}.gif">
                </div>
            </div>
            <div class="row">
                <div class="col-md-4">
                    <table class="table table-striped table-no-bordered table-hover">
                        <thead>
                        <tr>
                            <th>参数</th>
                            <th>指标</th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr>
                            <th>上市日期</th>
                            <th>{{ stock.start_date | date:'Y-m-d' }}</th>
                        </tr>
                        <tr>
                            <th>退市日期</th>
                            <th>{{ stock.end_date | date:'Y-m-d' }}</th>
                        </tr>
                        <tr>
                            <th>缩写</th>
                            <th>{{ stock.stock_abbreviated_name }}</th>
                        </tr>
                        </tbody>
                    </table>
                </div>
                <div class="col-md-4">
                    <table class="table table-striped table-no-bordered table-hover">
                        <tbody>
                        <tr>
                            <th>时间</th>
                            <th>{{ call_auction.time | date:'Y-m-d' }}</th>
                        </tr>
                        <tr>
                            <th>当前价</th>
                            <th>{{ call_auction.current }}</th>
                        </tr>
                        <tr>
                            <th>累计成交量（股）</th>
                            <th>{{ call_auction.volume }}</th>
                        </tr>
                        <tr>
                            <th>累计成交额（元）</th>
                            <th>{{ call_auction.money }}</th>
                        </tr>
                        </tbody>
                    </table>
                </div>
                <div class="col-md-4">
                    <table class="table table-striped table-no-bordered table-hover">
                        <tbody>
                        <tr>
                            <th>五档卖量</th>
                            <th>五档买量</th>
                            <th>五档卖价</th>
                            <th>五档买价</th>
                        </tr>

                        <tr>
                            <th class="danger">{{ call_auction.a1_v }}</th>
                            <th class="success">{{ call_auction.b1_v }}</th>
                            <th class="danger">{{ call_auction.a1_p }}</th>
                            <th class="success">{{ call_auction.b1_p }}</th>
                        </tr>
                        <tr>
                            <th class="danger">{{ call_auction.a2_v }}</th>
                            <th class="success">{{ call_auction.b2_v }}</th>
                            <th class="danger">{{ call_auction.a2_p }}</th>
                            <th class="success">{{ call_auction.b2_p }}</th>
                        </tr>
                        <tr>
                            <th class="danger">{{ call_auction.a3_v }}</th>
                            <th class="success">{{ call_auction.b3_v }}</th>
                            <th class="danger">{{ call_auction.a3_p }}</th>
                            <th class="success">{{ call_auction.b3_p }}</th>
                        </tr>
                        <tr>
                            <th class="danger">{{ call_auction.a4_v }}</th>
                            <th class="success">{{ call_auction.b4_v }}</th>
                            <th class="danger">{{ call_auction.a4_p }}</th>
                            <th class="success">{{ call_auction.b4_p }}</th>
                        </tr>
                        <tr>
                            <th class="danger">{{ call_auction.a5_v }}</th>
                            <th class="success">{{ call_auction.b5_v }}</th>
                            <th class="danger">{{ call_auction.a5_p }}</th>
                            <th class="success">{{ call_auction.b5_p }}</th>
                        </tr>
                        </tbody>
                    </table>
                </div>
            </div>
            <div class="row">
                    <h2 class="text-center">公司简介</h2>
                    <table class="table table-striped table-no-bordered table-hover">
                        <tr>
                            <td class="text-left text-info">公司名称</td>
                            <td class=" text-warning">{{ info.company_name }}</td>
                            <td class="text-left text-info">公司英文名</td>
                            <td class=" text-warning">{{ info.company_english_name }}</td>
                            <td class="text-left text-info">上市日期</td>
                            <td class=" text-warning">{{ info.launch_date }}</td>
                        </tr>
                        <tr>
                            <td class="text-left text-info">发行价格</td>
                            <td class=" text-warning">{{info.offering_price  }}</td>
                            <td class="text-left text-info">主承销商</td>
                            <td class=" text-warning">{{info.lead_underwriter  }}</td>
                            <td class="text-left text-info">成立日期</td>
                            <td class=" text-warning">{{info.setup_date  }}</td>
                        </tr>
                        <tr>
                            <td class="text-left text-info">注册资本</td>
                            <td class="text-warning">{{info.registered_capital  }}</td>
                            <td class="text-left text-info">机构类型</td>
                            <td class="text-warning">{{info.body_type  }}</td>
                            <td class="text-left text-info">组织形式</td>
                            <td class="text-warning">{{info.organizational_form  }}</td>
                        </tr>
                        <tr>
                            <td class="text-left text-info">董事会秘书</td>
                            <td class="text-warning">{{info.board_secretary  }}</td>
                            <td class="text-left text-info">公司电话</td>
                            <td class="text-warning">{{info.phone_company  }}</td>
                            <td class="text-left text-info">董秘电话</td>
                            <td class="text-warning">{{info.chairman_secretary_phone  }}</td>
                        </tr>
                        <tr>
                            <td class="text-left text-info">公司传真</td>
                            <td class="text-warning">{{info.company_fax  }}</td>
                            <td class="text-left text-info">董秘传真</td>
                            <td class="text-warning">{{info.chairman_fax  }}</td>
                            <td class="text-left text-info">公司电子邮箱</td>
                            <td class="text-warning">{{ info.company_e_mail  }}</td>
                        </tr>
                        <tr>
                            <td class="text-left text-info">公司网址</td>
                            <td class="text-warning">{{info.company_web_site  }}</td>
                            <td class="text-left text-info">邮政编码</td>
                            <td class="text-warning">{{info.zip_code  }}</td>
                            <td class="text-left text-info">注册地址</td>
                            <td class="text-warning">{{info.registered_address  }}</td>
                        </tr>
                        <tr>
                            <td class="text-left text-info">上市市场</td>
                            <td class="text-warning">{{info.listed_market  }}</td>
                            <td class="text-left text-info">办公地址</td>
                            <td class="text-warning">{{info.office_address  }}</td>
                        </tr>
                    </table>
                </div>
            <div class="row">
                <div class="col-md-12">
                    <table class="table table-striped table-no-bordered table-hover">
                        <tbody>
                        <tr>
                            <th>日期</th>
                            <th>融资余额(元）</th>
                            <th>融资买入额（元）</th>
                            <th>融资偿还额（元）</th>
                            <th>融券余量（股）</th>
                            <th>融券卖出量（股）</th>
                            <th>融券偿还量（股）</th>
                            <th>融资融券余额（元）</th>
                        </tr>
                        {% for financing in mtss %}
                            <tr>
                                <th>{{ financing.date | date:'Y-m-d' }}</th>
                                <th>{{ financing.fin_value }}</th>
                                <th>{{ financing.fin_buy_value }}</th>
                                <th>{{ financing.fin_refund_value }}</th>
                                <th>{{ financing.sec_value }}</th>
                                <th>{{ financing.sec_sell_value }}</th>
                                <th>{{ financing.sec_refund_value }}</th>
                                <th>{{ financing.fin_sec_value }}</th>
                            </tr>
                        {% endfor %}
                        </tbody>
                    </table>
                </div>
            </div>
            <div class="row col-md-12">
                <div class="card" style="min-height: 485px">
                    <div class="header">
                        <h4 class="title">日线</h4>
                    </div>
                    <div class="col-md-12">
                        <img style="padding: 5%"
                             src="http://image.sinajs.cn/newchart/daily/n/{{ stock.exchange_address.stock_sina_name }}{{ stock.code }}.gif">
                    </div>
                </div>
            </div>
        </div>
    </div>
{% endblock %}


{% block pagescript %}
{% endblock %}

